<template>
  <div class="container">
    <el-main>
      <el-card
        class="box-card"
        v-for="(item, index) in tableData"
        :key="item.mergeOrderId"
      >
        <el-table
          ref="multipleTable"
          :data="item.orderList"
          tooltip-effect="dark"
          style="width: 100%"
          @selection-change="handleSelectionChange"
          header-row-class-name="header"
          cell-class-name="bodyer"
          :show-header="!index"
        >
          <el-table-column prop="goods" label="商品" width="670">
            <template slot-scope="scope">
              <div style="height: 100px;" class="goods_box">
                <div style="width:100px;height:100px;">
                  <img
                    :src="scope.row.titlePicUrl"
                    alt=""
                    style="width: 100%;height: 100%;"
                  />
                </div>
                <div class="goods_info">
                  <p>{{ scope.row.productName }}</p>
                  <p>{{ scope.row.productSpecs }}</p>
                </div>
              </div>
            </template>
          </el-table-column>
          <el-table-column label="单价" width="150" prop="price">
            <template slot-scope="scope">
              <div class="price">￥{{ scope.row.productPrice2 }}</div>
            </template>
          </el-table-column>
          <el-table-column label="数量" width="150" prop="saleCount">
          </el-table-column>
          <el-table-column prop="count" label="总计" width="160">
            <template slot-scope="scope">
              <div class="count">￥{{ scope.row.totalPrice }}</div>
            </template>
          </el-table-column>
        </el-table>

        <el-button
          round
          class="pay_btn"
          @click="pay(item.mergeOrderId, item.mergePrice)"
          >继续支付</el-button
        >
      </el-card>
    </el-main>
  </div>
</template>

<script>
import { get_data } from "@/utils/utils";
export default {
  name: "TobeReceived",
  data() {
    return {
      dialogVisible: false,
      tableData: [],
      multipleSelection: [],
      tuikuanInfo: "",
      userInfo: {},
      pageNo: 0,
      total: 0,
      oderId: 0,
    };
  },
  mounted() {
    let userInfo = get_data("userInfo");
    this.userInfo = JSON.parse(userInfo);
    this.getData();
  },
  methods: {
    getData() {
      this.$http
        .fetch(this.$apiPath.getOrder, {
          method: "get",
          params: {
            customerId: this.userInfo.id,
            page: 1,
            payStatus: 0,
          },
        })
        .then((res) => {
          if (res.data && res.data.length) {
            this.tableData = res.data;
            this.total = this.tableData.length;
          }
        });
    },

    pay(id, price) {
      this.$router.push({
        path: "/pay",
        query: {
          mergeOrderId: id,
          totalPrices: price,
        },
      });
    },
  },
};
</script>

<style lang="less" scoped>
.container {
  /deep/.el-table th > .cell {
    text-align: center;
  }
  /deep/.bodyer {
    text-align: center;
  }
  /deep/.el-checkbox__input.is-checked .el-checkbox__inner {
    background-color: #cf975a;
    border: #cf975a;
  }
  /deep/.el-checkbox__input.is-indeterminate .el-checkbox__inner {
    background-color: #cf975a;
    border: #cf975a;
  }
  /deep/.el-checkbox__inner {
    border-radius: 50% !important;
  }
  .goods_box {
    box-sizing: border-box;
    display: flex;
    .goods_info {
      padding: 25px 0;
      margin-left: 23px;
      p:first-child {
        font-size: 14px;
        font-family: PingFangSC;
        font-weight: 400;
        color: #666666;
        margin-bottom: 10px;
      }
      p:last-child {
        font-size: 12px;
        font-family: Source Han Sans CN;
        font-weight: 300;
        color: #999999;
      }
    }
  }
  .price,
  .count {
    font-size: 18px;
    font-weight: 500;
    color: #ff9933;
  }
  .oper {
    p:first-child {
      font-size: 14px;
      font-weight: 400;
      color: #999999;
      cursor: pointer;
    }
    .wuliu {
      font-size: 14px;
      font-weight: 400;
      color: #ff9933;
      cursor: pointer;
      margin-bottom: 8px;
    }
  }
  .isOver {
    overflow: hidden;
    padding-right: 50px;
    margin-top: 67px;
    button {
      float: right;
      width: 150px;
      padding: 17px 20px;
      background: #cf975a;
      border-radius: 28px;
    }
  }
  .el-dialog__title {
    font-size: 30px;
    font-weight: 500;
    color: #5c5f68;
    margin-top: 10px;
  }
  .content {
    .title {
      font-size: 18px;
      font-weight: 400;
      color: #333333;
    }
    .product_info {
      display: flex;
      margin-top: 20px;
      align-items: center;
      margin-bottom: 20px;
      .img {
        width: 100px;
        height: 100px;
        margin-right: 24px;
        img {
          width: 100%;
          height: 100%;
          border-radius: 5px;
        }
      }
      .product_name {
        height: 49px;
        width: 406px;
        .title {
          margin-bottom: 10px;
          font-size: 14px;
          font-weight: 600;
          color: #666666;
          width: 100%;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
        }
        .product_name {
          font-size: 12px;
          font-weight: 300;
          color: #9999;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
        }
      }
    }
    .test {
      margin-top: 20px;
      margin-bottom: 30px;
    }
    .money {
      span:last-child {
        float: right;
        font-size: 18px;
        font-weight: 400;
        color: #ff9933;
      }
    }
    .submit {
      padding-right: 0;
      display: flex;
      justify-content: center;
    }
  }
  /deep/.footer {
    padding: 0;
    margin: 0 auto;
    margin-top: 30px;
    margin-bottom: 33px;
    background-color: #ffffff;
    .btn-prev {
      width: 74px;
      height: 30px;
      border: 1px solid #c7c7c7;
      border-radius: 15px;
    }
    .btn-next {
      width: 74px;
      height: 30px;
      border: 1px solid #c7c7c7;
      border-radius: 15px;
      color: #999999;
    }
    .el-pager li {
      width: 30px;
      height: 30px;
      border: 1px solid #c7c7c7;
      border-radius: 15px;
      color: #999999;
    }
    .el-pager {
      .number {
        text-align: center;
        padding: 0;
      }
      //   .number:hover {
      //     color: #999999 !important;
      //   }
      li:not(.active).number:hover {
        color: #999999 !important;
      }
    }
    .el-pager li:not(.disabled).active {
      background-color: #cf975a;
    }
  }
  .pay_btn {
    background-color: #ff9933;
    color: white;
    margin-top: 12px;
    margin-left: 1000px;
  }
}
</style>
